/*添加工单动态*/
function initOrderArr(){
	var list = [{'state':1,'title':'21层整层上不去网','receiver':'张三','time':'3分钟前','result':'已转高级工程师'}
		,{'state':0,'title':'9层901上不去网','receiver':'','time':'5分钟前','result':''}
		,{'state':1,'title':'21层整层上不去网','receiver':'张三','time':'12分钟前','result':''}
		,{'state':0,'title':'21层整层上不去网','receiver':'','time':'31分钟前','result':''}
	];
	var str = '';
	var spanColor = '';
	var spanText = '';
	for(var i in list){
		if(list[i].state == 0){
			spanColor = 'layui-btn-danger';
			spanText = '未分配';
		}else{
			spanColor = 'layui-btn-normal';
			spanText = '处理中';
		}
		var rec = '';
		if(list[i].receiver){
			rec = `<span>${list[i].receiver}<i class="layui-icon layui-icon-log" style="color:#4acacb"></i></span>`
		}else{
			rec = `<span style="color:#3b9dff">未分配</span>`
		}
		str += `<li class="layui-timeline-item">
			<i class="layui-icon layui-timeline-axis">&#xe63f;</i>
			<div class="layui-timeline-content layui-text">
			  <h3 class="layui-timeline-title"><span class="layui-btn layui-btn-xs ${spanColor}">${spanText}</span></h3>
			  <p><strong>!</strong>${list[i].title} ${rec}</p>
			  <div>${list[i].result}</div>
			  <samp>${list[i].time}</samp>
			</div>
		  </li>`
	}
	$("#orderArr").html(str);
}
/*在岗人员列表*/
function staffList(){
	var userList = [{
		title:'网络工程师',
		list:[
			{'name':'张强',time:'08:00-18:00'},
			{'name':'刘飞',time:'08:00-18:00'},
			{'name':'王闯',time:'08:00-18:00'}
		]
	},{
		title:'桌面组',
		list:[
			{'name':'张强',time:'08:00-18:00'},
			{'name':'刘飞',time:'08:00-18:00'},
			{'name':'王闯',time:'08:00-18:00'}
		]
	}]
	var str = '';
	userList.forEach(item =>{
		str +=`<h3>${item.title}</h3><div class="userList">`;
		item.list.forEach(obj =>{
			str +=`<dl><dt><span>${obj.name}</span></dt><dd>(${obj.time})</dd></dl>`
		})
		str +='</div>';
	})
	$("#staff").html(str);
}
function getTable(index){
	var data = [[
			{title:'9层901上不去网',customerName:'李丽',state:0,time:'2019.4.12 15:38'}
			],[
			{title:'9层901上不去网',customerName:'李丽',state:1,time:'2019.4.12 15:38'}
			]]
	layui.table.render({
		elem: '#table'+index
		,height: 312
		,url: '' //数据接口
		,page: true //开启分页
		,cols: [[ //表头
		  {field: 'xh', title: '编号', width:80,align:'center'
			  ,templet:function(d){
				  return d.LAY_INDEX;
			  }}
		  ,{field: 'title', title: '标题',align:'center'}
		  ,{field: 'customerName', title: '客户', width:150,align:'center'}
		  ,{field: 'state', title: '状态', width:80,align:'center',
			templet:function (d) {
				var colors = ['before','processing','resolved','closed'];
				var states = ['未分配','处理中','已解决','已关闭'];
				return `<span class="layui-btn layui-btn-radius layui-btn-xs ${colors[d.state]}">${states[d.state]}</span>`
			}
		  } 
		  ,{field: 'time', title: '创建日期', width: 150,align:'center'}
		]],
		data:data[index]
	})
}